package com.hua.designpattern.creational.simplefactory;

public class DrivableFactory {

	public static Drivable getBean(String type) {
		if ("Automobile".equalsIgnoreCase(type)) {
			System.err.println("Automobile is created");
			return new Automobile();
		} else if ("Bicycle".equalsIgnoreCase(type)) {
			System.err.println("Bicycle is created");
			return new Bicycle();
		} else if ("Train".equalsIgnoreCase(type)) {
			System.err.println("Train is created");
			return new Train();
		} else {
			System.err.println("no drivable named " + type + " can created");
			throw new NullPointerException();
		}
	}

}
